<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head>
<body>
    <div id="app">
        <aki v-model:first-name="firstName" v-model:last-name="lastName" v-model:age="age"></aki>
        <p>姓名是{{firstName+lastName}}, 年龄是{{age}}</p>
    </div>

    <script>
        const app = Vue.createApp({
            data(){
                return {
                    age:20,
                    firstName:'Akiyama',
                    lastName:'Mio'
                }

            }
        });
        app.component('Aki',{
            props:{
                firstName:String,
                lastName:String,
                age:Number
            },
            template:`
            <p>
                <input size="6" placeholder="姓" :value="firstName" @input="$emit('update:firstName', $event.target.value)">
                <input size="6" placeholder="名" :value="lastName" @input="$emit('update:lastName', $event.target.value)">
                <input type="number" size="3" placeholder="年龄" :value="age" @input="$emit('update:age', $event.target.value)">
            </p>
            `
            
        })
        const vm = app.mount('#app')

    </script>
</body>
</html>